<{include file="Public/top.html" }>
	</head>
	<body>
		<div id="warpper">
            <div class="content">
                <div class="location">资讯文章</div>
                <{include file="./nav.html" }>
                <div class="filedSet" style="padding-bottom: 0;">
                    <div class="search">
                        <form action="" id="searchForm" method="get" class="ui-form reportForm">
                            <div class="ui-form-item inline-block">
                                <input type="text" value="" class="ui-text bg-text keyword" id="keyword" placeholder="标题关键字" style="width: 80px;" />
                            </div>

                            <div class="ui-form-item inline-block">
                                <label class="ui-label">标签</label>
                                <select id="contentType" class="ui-select" style="width: 100px;">
                                    <option value="0">全部</option>
                                    <{html_options options=$contentType }>
                                </select>
                            </div>
                            <{*
                            <div class="ui-form-item inline-block">
                                <label class="ui-label">来源</label>
                                <select id="createSystem" class="ui-select" style="width: 100px;">
                                    <{html_options options=$clientFrom selected=$selectedClientShow}>
                                </select>
                            </div>

                            <div class="ui-form-item inline-block">
                                <label class="ui-label">审核状态</label>
                                <select name="audit" class="ui-select" style="width: 100px;">
                                    <{html_options options=$clientFrom selected=$selectedClientShow}>
                                </select>
                            </div>
                            *}>
                            <div class="ui-form-item inline-block">
                                <button type="button" class="ui-button" id="search" onclick="LayerShow();">搜索</button>
                            </div>
                        </form>
                    </div>
                </div> 
                             
                
                <!--表格内容-->
                <div class="mainGrid">
                    <table class="ui-table ui-body">
                        <thead>
                        <tr>
                            <th class="pct15">标题</th>
                            <th class="pct10">标签</th>
                            <th class="pct12">来源</th>

                            <th class="pct9"><a href="javascript:void(0)" onclick="changeOrder(1)">引用次数</a><span class="<{if $ofield eq 1}><{$otype}><{/if}>"></span></th>
                            <th class="pct12">上传时间</th>
                            <th class="pct12 last-col">操作</th>
                        </tr>
                        </thead>
                        <tbody id="content">
                            <tr><td colspan="6">正在努力加载中...</td></tr>
                        </tbody>
                    </table>
                </div>


                    <!--描述：分页-->
                    <div style="text-align:right;">
                        <select class="ui-select" id="pageSize" onchange="LayerShow();" style="width:95px; border-radius:5px; float:left; margin-top:10px;">
                            <option value="10">显示10条</option>
                            <option value="15">显示15条</option>
                            <option value="20">显示20条</option>
                        </select>
                        <span>共 <span id="rowCount">3</span> 条数据</span>
                        <div class="pagination inline-block">
                            <a href="javascript:void(0)" class="prev" id="prev" onclick="LayerShow();">◀</a>
                            <span><i class="cur" id="currentPage">1</i>/<i class="total" id="totalPage">5</i></span>
                            <a href="javascript:void(0)" class="next" id="next" onclick="LayerShow();">▶</a>
                            <input type="text" class="page" id="go" onkeyup="if(event.keyCode == 13){LayerShow();jumpPage();}"/>
                            <button type="button" id="jump" onclick="LayerShow();" >跳转</button>
                        </div>
                    </div>


            </div>
		</div>

        <script>
            function prevPage(){
                var currentPage=$('#currentPage').text();
                if(currentPage<=1){
                    layer.msg("已到最前页");
                    return;
                }
                getQuery(parseInt(currentPage)-1);
            }

            function nextPage(){
                var currentPage=$('#currentPage').text();
                if(currentPage>=$('#totalPage').text()){
                    layer.msg("已到最后页");
                    return;
                }
                getQuery(parseInt(currentPage)+1);
            }

            function jumpPage(){

                var page=$('#go').val();
                if(page<1){
                    parent.closeLoading();
                    return;
                }
                if(page>=$('#totalPage').text()+0){
                    parent.closeLoading();
                    return;
                }
                if(page==$('#currentPage').text()+0){
                    parent.closeLoading();
                    return;
                }
                getQuery(page);
            }
            function query(){
                getQuery(1);
            }

            function getQuery(nextPage){
                var keyword=$('#keyword').val();
                var contentType=$('#contentType').val();
                var sys=$('#sys').val();

                var pageSize=$('#pageSize').val();
                var data={
                    'keyword':keyword,
                    'contentType':contentType,
                    'sys':sys,

                    'pageSize':pageSize,
                    'page':nextPage,
                }
                $.post("<{$CENTER_URL}>",data,showResult,'json');
            }

            function showResult($result){
                parent.closeLoading();
                $('#rowCount').text($result.total);
                $('#currentPage').text($result.page);
                $('#totalPage').text($result.totalPage);
                $('#content').empty().html($result.dataHtml);
                $('.title').on('mouseover',function(e){
                    if(e.target.tagName!='TD'){
                        return;
                    }
                    layer.closeAll();
                    var url=$(e.target).attr('data');
                    var title = e.target.innerText;
                    layer.tips("<h1 style='color: #000000;text-overflow:ellipsis;overflow: hidden;display: -webkit-box;-webkit-line-clamp: 1;-webkit-box-orient: vertical;min-height: 25px;'>"+title+'</h1><img src="'+url+'" style="width:280px;height:140px;">', e.target,
                            {
                                tips:[4,'#ffffff'],
                                area: ['300px', '180px'],
                                skin:'BoxShadow'
                            });

                })
            }

            $(document).ready(
                    function(){
                        $('#search').bind('click',query);
                        $('#pageSize').on('change',query);
                        $('#jump').bind('click',jumpPage);
                        $('#prev').bind('click',prevPage);
                        $('#next').bind('click',nextPage);
                        query();
                    }
            )

            function pull(id){
                $.get("<{u('pull')}>"+'&id='+id,function(result){
                    if(result.status==0){
                        layer.msg('拉取成功');
                        location.href="<{u('Article/edit?id=')}>"+result.id;
                    }else{
                        layer.msg(result.msg);
                    }
                },'json');
            }

        </script>

	</body>
<{include file="Public/foot.html" }>
</html>

